package homes;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class Configuracion {

	private static SessionFactory sessionFactory;
	
	public static Session getSession(){
		if(Configuracion.sessionFactory==null){
			Configuration cfg = new Configuration();
			cfg.configure();
			sessionFactory = cfg.buildSessionFactory();
			
		
		}
		
		Session session=sessionFactory.openSession();
		
		return session;
	}
	
}
